/**
 * 用于接收JQGrid发送的参数
 **/

package com.mall.ibatis.bean;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;

import com.mall.util.JQGridUtil;
import com.mall.util.StringUtil;

@SuppressWarnings("serial")
public class JQGridParameters implements Serializable {
	//prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd"},
	private Boolean search;			/*是否搜索*/
	private String newDate;            /*随机数，用于处理提交前由于缓存原因没有向后台提交请求问题*/
	
	private Integer page;              /*当前页数*/
	private Integer rows;			   /*当前页面记录数*/
	
	private String sortIndex;         /*排序列*/
	private String sortOrder;		  /*排序方式 asc desc*/
	
	
	
	//sField:'searchField',	sValue:'searchString',	sOper: 'searchOper',
	private String searchField;      /*查找栏位*/
	private String searchOperator; /*查找方式*/
	private String searchString;     /*查找字符串*/
	
	//sFilter: 'filters',
	private String filters;             /*多条件查询字符串*/

	private String sortString;
	private String filterString;
	private String pageString;
	
	public void initParametes(HttpServletRequest request)
	{
		this.search = StringUtil.toBoolean(request.getParameter("_search"));
		this.newDate = request.getParameter("nd");
		this.page = StringUtil.toInteger(request.getParameter("page"));
		this.rows = StringUtil.toInteger(request.getParameter("rows"));
		this.sortIndex = request.getParameter("sidx");
		this.sortOrder =  request.getParameter("sord");
		
		//sField:'searchField',	sValue:'searchString',	sOper: 'searchOper',
		this.searchField = request.getParameter("searchField");
		this.searchOperator =  request.getParameter("searchOper");
		this.searchString = request.getParameter("searchString");
		
		this.filters = request.getParameter("filters");
		
		this.sortString = JQGridUtil.wrapSortString(sortIndex, sortOrder);
		this.filterString = JQGridUtil.warpFilters(filters);
		this.pageString = JQGridUtil.wrapPageString(page, rows);
	}

	public Boolean getSearch() {
		return search;
	}

	public void setSearch(Boolean search) {
		this.search = search;
	}

	public String getNewDate() {
		return newDate;
	}

	public void setNewDate(String newDate) {
		this.newDate = newDate;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public String getSortIndex() {
		return sortIndex;
	}

	public void setSortIndex(String sortIndex) {
		this.sortIndex = sortIndex;
	}

	public String getSortOrder() {
		return sortOrder;
	}

	public void setSortOrder(String sortOrder) {
		this.sortOrder = sortOrder;
	}

	public String getSearchField() {
		return searchField;
	}

	public void setSearchField(String searchField) {
		this.searchField = searchField;
	}

	public String getSearchOperator() {
		return searchOperator;
	}

	public void setSearchOperator(String searchOperator) {
		this.searchOperator = searchOperator;
	}

	public String getSearchString() {
		return searchString;
	}

	public void setSearchString(String searchString) {
		this.searchString = searchString;
	}

	public String getFilters() {
		return filters;
	}

	public void setFilters(String filters) {
		this.filters = filters;
	}

	public String getSortString() {
		return sortString;
	}

	public void setSortString(String sortString) {
		this.sortString = sortString;
	}

	public String getFilterString() {
		return filterString;
	}

	public void setFilterString(String filterString) {
		this.filterString = filterString;
	}

	public String getPageString() {
		return pageString;
	}

	public void setPageString(String pageString) {
		this.pageString = pageString;
	}

	
	
	
	
	
}
